// pages/myinformation/myinformation.js
const app = getApp()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    tempFilePaths: '',
    nickName:'',
    userInfoAvatar:'',
    sex:'',
    province:'',
    city:'',
    items: [
      {name: 'man', value: '男'},
      {name: 'femail', value: '女', checked: 'true'},
      {name: 'bm', value: '保密'}
    ],
    array: [{
      mode: 'aspectFill',
      text: 'aspectFill：保持纵横比缩放图片，只保证图片的短边能完全显示出来'
    }],
    avatarUrl: './user-unlogin.png',
    userInfo: {},
    logged: false,
    takeSession: false,
    requestResult: '',
    url1:"http://m.qpic.cn/psc?/V10sXncQ0Rsaqc/Av9ya3JsDKBK2b.GrRYxFyAriWZ6EU1fvZpqOUVbKkm6BJed385VQSJsh.tadb6bQlx9Ox.K6cDIyJ1GgPgl6g!!/b&bo=3ADcAAAAAAARBzA!&rf=viewer_4",
    url2:"http://m.qpic.cn/psc?/V10sXncQ0Rsaqc/Av9ya3JsDKBK2b.GrRYxF26VrsiRvYZ0Ui*k61rdF16ThNUv9VGSAvm4LeuZ3xh2GeVar.WKGKjX9*nouk5V*Q!!/b&bo=AAIAAgAAAAARBzA!&rf=viewer_4",
    url3:"http://m.qpic.cn/psc?/V10sXncQ0Rsaqc/Av9ya3JsDKBK2b.GrRYxFwiWbEJmx*.688NjlIigbzRuqP6Hd4mqOny.EbjcHV.SGAqMM3p5ybtvG42A8kgApA!!/b&bo=9AG.AQAAAAARB3o!&rf=viewer_4",
    url4:"http://m.qpic.cn/psc?/V10sXncQ0Rsaqc/Av9ya3JsDKBK2b.GrRYxF7Z9kI1yWkBN3GWkuuA7WZmcg5gqc.QSYqFudR7mOoulVdvt0i*GrPW9Xrl4i3G0jA!!/b&bo=9AH0AQAAAAARBzA!&rf=viewer_4"
  },

  goToOnshelf:function(e){
    wx.navigateTo({
      url: 'onshelf/onshelf',
    })
    return
  },
  goToInf:function(e){
    wx.navigateTo({
      url: 'inf/inf',
    })
    return
  },

  goToHavebuy:function(e){
    wx.navigateTo({
      url: 'havebuy/havebuy',
    })
    return
  },

  goToMesg:function(e){
    wx.navigateTo({
      url: 'mesg/mesg',
    })
    return
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that=this;
    wx.getUserInfo({
      success: function(res){
        console.log(res.userInfo)

        // success
        that.setData({
          nickName:res.userInfo.nickName,
          userInfoAvatar:res.userInfo.avatarUrl,
        })
      },
    })
    wx.cloud.callFunction({
      name: 'login',
      data: {
      },
        success: res => {
          console.log(res.result.openid)
          app.globalData.openid=res.result.openid
        },
        fail: err => {
          console.error('[云函数] [login] 调用失败', err)
        }
      })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})